﻿@section style
{
    <style type="text/css">
        #txtURL { width: 450px; }
        #txtArgs { width: 200px; }
        #divResponse {-moz-user-select: text; -ms-user-select: text; -webkit-user-select: text; user-select: text;}
    </style>    
}

@{
    <select id="slcMethod">
        <option>GET</option>
        <option>POST</option>
        <option>PUT</option>
        <option>DELETE</option>
    </select>
    <input type="text" id="txtURL" value="http://localhost:1635/api/DishCategoryAPI/Get/" />
    <input type="text" id="txtArgs" value="" /><br/>
    <textarea id="txtBody"></textarea>
    <button id="btnSendRequest">Send</button>
    <div id="divResponse"></div>
}

@section scripts
{
    <script type="text/javascript">
        $("#btnSendRequest").on("click", function() {
            $.ajax({
                type: $("#slcMethod").val(),
                url: $("#txtURL").val().trim() + $("#txtArgs").val(),
                dataType: "application/json",
                data: { value: $("#txtBody").val() === "" ? "" : $("#txtBody").val() }
            }).always(function(response) {
                $("#divResponse").html(response.responseText);
            });
        });
    </script>
}
